/**
 * 通用API接口
 */
import apiClient from './client';
import { BaseResponse } from '../types/response';

/**
 * 获取身份证id是否有效
 * @param idCard 身份证id
 * @returns 身份证id是否有效
 */
export const getIdCardValidApi = async (idCard: string): Promise<BaseResponse> => {
  return apiClient.get('/api/common/v1/idcard-valid', {
    card: idCard
  });
};


/**
 * 身份证识别接口
 * @param imageBase64 身份证图片base64编码
 * @param cardSide 身份证正反面，FRONT为正面（人像面），BACK为反面（国徽面）
 * @returns 身份证识别结果
 */
export const getIdCardOcrApi = async (key: string, cardSide: string = 'FRONT', uid: string = ''): Promise<BaseResponse> => {
  return apiClient.post('/api/common/v1/idcard-ocr', {
    image_key:key,
    card_side: cardSide,
    uid
  });
};

/**
 * 教练证识别接口
 * @param imageBase64 教练证图片base64编码
 * @returns 教练证识别结果
 */
export const getCoachLicenseOcrApi = async (key: string): Promise<BaseResponse> => {
  return apiClient.post('/api/common/v1/coach-license-ocr', {
    image_key:key
  });
};